const websockify  = require('koa-websocket')
const wsRoute = require("koa-route");

module.exports = function (app){
  console.log('websocket启动');
  websockify(app);
  
  app.ws.use(wsRoute.all('/website/autoamtic/ws/test',  function (ctx) {
    ctx.websocket.send('Hello World');
    ctx.websocket.on('message', function(message) {
      // do something with the message from client
      console.log(message);
    });
  }));
}